﻿using System;
using System.ComponentModel;
using System.Drawing;

namespace HML
{
    /// <summary>
    /// DropDownListPlus选项
    /// </summary>
    public class DropDownListPlusItem
    {
        #region 属性

        private bool enabled = true;
        /// <summary>
        /// 选项是否启用
        /// </summary>
        public bool Enabled
        {
            get { return this.enabled; }
            set { this.enabled = value; }
        }

        /// <summary>
        /// 选项文本
        /// </summary>
        public string Text { get; set; }

        /// <summary>
        /// 选项图片
        /// </summary>
        public Image Image { get; set; }

        /// <summary>
        /// 选项自定义数据
        /// </summary>
        public object Tag { get; set; }

        /// <summary>
        /// 鼠标是否已进入
        /// </summary>
        [Browsable(false)]
        public bool IsMouseEnter
        {
            get
            {
                if (this.owner == null || this.owner.Owner == null)
                    return false;

                return this.owner.Owner.IsMouseEnter(this);
            }
        }

        private DropDownListPlusItemCollection owner = null;
        /// <summary>
        /// 选项所属的列表
        /// </summary>
        public DropDownListPlusItemCollection Owner
        {
            get { return this.owner; }
            protected internal set { this.owner = value; }
        }

        #endregion

        #region 公开方法

        /// <summary>
        /// 浅度复制
        /// </summary>
        /// <returns></returns>
        public DropDownListPlusItem Copy()
        {
            return new DropDownListPlusItem() { Enabled = this.Enabled, Text = this.Text, Image = this.Image, Tag = this.Tag };
        }

        #endregion

    }

}
